<%--
  Created by IntelliJ IDEA.
  User: tum0r
  Date: 2018-11-29
  Time: 00:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.io.File" %>
<%@ page import="java.net.URLDecoder" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <link rel="icon" href="../../favicon.ico">

    <title>查看图片</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/signin.css" rel="stylesheet">

</head>

<body>
<%
    String title = request.getParameter("title");
    String name = request.getParameter("name");
    String fileName = null;
    if (title != null && !title.equals("") && name != null && !name.equals("")) {
        title = URLDecoder.decode(title, "utf-8");
        name = URLDecoder.decode(name, "utf-8");
        fileName = "./classes/upload" + File.separator + title + File.separator + name;
    }
%>
<!-- page header start-->
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="home.jsp">Home</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
            <ul class="nav navbar-nav navbar-right">
                <%
                    String user = (String) request.getSession().getAttribute("user");
                    if (user == null || user.equals("")) {
                %>
                <li><a href="login.jsp">登录</a></li>
                <li><a href="register.jsp">注册</a></li>
                <%
                } else {
                %>
                <li><a href=""><%=request.getSession().getAttribute("user")%>
                </a></li>
                <li><a href="/computerbase/edit.jsp">发帖</a></li>
                <%
                    if ((boolean) request.getSession().getAttribute("manager")) {
                %>
                <li><a href="/computerbase/manager.jsp">管理</a></li>
                <%
                    }
                %>
                <li><a href="/computerbase/logout">退出</a></li>
                <%
                    }
                %>
            </ul>
        </div><!--/.nav-collapse -->
    </div>
</nav>
<!-- page header end-->

<div class="container" style="padding: 88px 0 0">

    <div class="col-xs-12 col-sm-12">
        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading"><%=title%> - <%=name%>
            </div>
            <div class="panel-body">
                <p><img src="<%=fileName%>"></p>
            </div>
        </div>
    </div>

</div>

</div> <!-- /container -->


</body>
</html>
